<template>
  <div class="bg-fa of">
    <div class="mt50 c-infor-box" style="margin-left: 150px; margin-right: 150px">
      <el-button style="float: right"  type="success" round @click="toQuestion">返回文章列表</el-button>
      <el-divider/>


      <h2>{{ question.title }}</h2>
      <br>

      <div
          style="float: left; display: flex; align-items:center;"
          class="tac">
        <el-avatar :size="50"  v-if="user.avatar"  :src="user.avatar" />
        <span class="fsize12" style="margin-left: 10px">{{ user.stuName }}</span>
      </div>
      <br>
      <br>
      <br>


      <div class="ql-container ql-snow">
          <mavon-editor  v-model="question.content" default-open="preview"
                        :toolbarsFlag="false"
                        :subfield="false" />
      </div>
      <div class="of mt5">
        <span class="fr"><font class="fsize12 c-999 ml5">{{ question.updateTime }}</font></span>
      </div>
      <el-divider/>
      <br>

    </div>
  </div>




</template>

<script>
import {ref} from "vue";
import 'mavon-editor/dist/css/index.css'
export default {
  name: "Article",

  data(){
    return{
      user:{},
      question:{},
      answer: {
        questionId: '', // 当前回复的问题id
        content: '', // 当前评论内容
        replyId: '0', // 当前要回复的评论id，默认0
        parentId: '0' // 当前是在哪个评论下回复的id，默认0
      }, // 回答对象
      courseTitle:'',
      dialogTableVisible : ref(false),
      tableData: [],
      gridData:[],

    }

  },
  watch: {
    '$route': "artDetails",
  },
  created() {
    this.artDetails()
  },

  // mounted() {
  //   this.artDetails()
  // },
  methods: {
    toQuestion(){
      this.$router.replace("/student/stuArticle");
      // this.$router.push({path:'stuArticle'})
  },
    artDetails() {
      let _this = this
      console.log("接受学生num", _this.$route.query.stuNum)
      console.log("接受学生articleId", _this.$route.query.articleId)
      let stuNum = _this.$route.query.stuNum
      let articleId = _this.$route.query.articleId
      let url = "/studyadmin/person-article/articleDetails";
      _this.$axios.get(url, {params: {stuNum:stuNum,articleId:articleId}}).then(function (serverData) {
        console.log("wenzhang ==内容数据：", serverData.data.data)
        if (serverData.data.code == 0) {
          _this.question=serverData.data.data


        }
      })
      let url2 = "/studyadmin/student/stuMain";
      _this.$axios.get(url2,{params: {stuNum:stuNum}}).then(function(serverData) {
        console.log("serverData.data.data===",serverData.data.data)
        if(serverData.data.code===0){
          _this.user=serverData.data.data;
        }
      })
    }
  },
}
</script>

<style scoped>

</style>